package com.itheima.controller;

import com.itheima.common.R;
import com.itheima.service.CSetmealService;
import lombok.extern.log4j.Log4j2;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Author longbosheng
 * @Date 2022/6/19 18:48
 * @PackageName:com.itheima.controller
 * @ClassName: SetmealController
 * @Description: TODO
 * @Version 1.0
 */
@Log4j2
@RestController
@RequestMapping("/setmeal")
public class SetmealController {
    @Resource
    private CSetmealService csetmealService;

    /**
     * 菜品详情
     *
     * @param id
     * @return
     */
    @GetMapping("/dish/{id}")
    public R dishInfo(@PathVariable String id) {
        R result = csetmealService.dishInfo(id);
        return result;
    }

    /**
     * 套餐列表
     *
     * @param
     * @return
     */
    @GetMapping("/list")
    public R setmealList(String categoryId, Integer status) {
        R result = csetmealService.showList(categoryId, status);
        return result;
    }
}
